<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/mobileCheckList' }">手机号核审</el-breadcrumb-item>
            <el-breadcrumb-item>审核</el-breadcrumb-item>
        </el-breadcrumb>

        <div style="display: block;margin-top: 10px;font-size: large;margin-left: 50px;line-height: 40px">

            <div>
                <span>统一社会信用代码： </span>
                <span>{{this.orgInfo.orgId}}</span>
            </div>

            <div>
                <span>机构名称： </span>
                <span>{{this.orgInfo.orgName}}</span>
            </div>
            <div>
                <span>法定代表人： </span>
                <span>{{this.orgInfo.legalName}}</span>
            </div>
            <div>
                <span>法定代表人证件号： </span>
                <span>{{this.orgInfo.legalIdcard}}</span>
            </div>
        </div>


        <el-divider/>

        <div style="display: block;font-size: large;margin-left: 50px">
            <div>


                    <el-col :span="24">
                        <span>新手机号： </span>
                        <span>{{this.orgInfo.bakMobile}}</span>
                    </el-col>
                    <el-col :span="24">
                       ---------------------------
                    </el-col>
                    <el-col :span="3">
                        <span class="grid-content bg-purple">营业执照：</span>
                    </el-col>
                    <el-col :span="21">
                        <span style="height: 150px">
                        <vue-preview :slides="slide1" class="preview" alt=""></vue-preview>
                        </span>
                    </el-col>
                    <el-col :span="3">
                        <span class="grid-content bg-purple">法人证件：</span>
                    </el-col>

                    <el-col :span="21">
                        <span style="height: 150px">
                        <vue-preview :slides="slide2" class="preview" alt=""></vue-preview>
                        </span>
                    </el-col>

            </div>

        </div>



        <el-form :inline="true" :model="orgInfo" ref="orgInfo" class="paper-search" style="margin-top: 20px">
            <div style="margin-top: 10px;margin-right: 30px;text-align: right">
                <span>
                    审核结果：
                    <el-button size="small" style="text-align: right" type="success" @click="pass(orgInfo)"
                               icon="el-icon-check" circle/>
                    <el-button size="small" style="text-align: right" type="danger" @click="refuse(orgInfo)"
                               icon="el-icon-close" circle/>
                </span>

            </div>
        </el-form>
    </div>
</template>

<script>

    import {check, checkRes} from "../../../api/orgBaseMG";

    export default {
        name: "check-mobile-info",
        data() {
            return {
                orgInfo: [],
                slide1:[],
                slide2: [],
            }
        },
        methods: {
            pass(orgInfo) {
                this.$confirm('企业信息审核通过', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    console.log("===============>", orgInfo);
                    const params = {
                        orgId: orgInfo.orgId,
                        mobile:orgInfo.mobile,
                        status: '0'
                    };
                    checkRes(params).then(res => {
                        console.log("res====>", res);
                        if (res.code === 200) {
                            this.$router.push("MobileCheckList");
                            this.$message({
                                type: 'success',
                                message: '审核完成!'
                            });
                        }
                    });

                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消'
                    });
                });
            },
            refuse(orgInfo) {
                this.$confirm('企业信息审核不通过', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    console.log("===============>", orgInfo);
                    const params = {
                        orgId: orgInfo.orgId,
                        mobile:orgInfo.mobile,
                        status: '2'
                    };
                    checkRes(params).then(res => {
                        console.log("res====>", res);
                        if (res.code === 200) {
                            this.$router.push("MobileCheckList");
                            this.$message({
                                type: 'success',
                                message: '审核完成!'
                            });
                        }
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消'
                    });
                });
            }
        },
        created() {
            this.orgInfo = JSON.parse(window.localStorage.getItem('MOBILE_INFO'));
            let temp = {
                src: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('MOBILE_INFO')).bakOrgPath,
                msrc: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('MOBILE_INFO')).bakOrgPath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide1 = [temp];
            let temp2 = {
                src: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('MOBILE_INFO')).bakIdcardPath,
                msrc: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('MOBILE_INFO')).bakIdcardPath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide2 = [temp2];
            console.log("info", this.orgInfo);
        }
    }

</script>

<style scoped>

</style>

